import React, { useEffect, useState } from 'react'
//import React from 'react'
import { Form, Input, InputNumber, Popconfirm, Table, Typography } from 'antd';
import axios from "axios";
import api from '../../server/Api';

export default function chargeBill() {
    const [dataSource, setDataSource] = useState([]);
    const [loading, setLoading] = useState(true);
    const columns = [
    {
        title: '账单时间',
        dataIndex: 'billTime',
        key: 'billTime',
    },
    {
        title: '计算开始日期',
        dataIndex: 'startTime',
        key: 'startTime',
    },
    {
        title: '计算截止日期',
        dataIndex: 'endTime',
        key: 'endTime',
    },
    {
        title: '计算人',
        dataIndex: 'username',
        key: 'username',
    },
    {
        title: '操作',
        dataIndex: 'operation',
        
    },
    ];
    // 清除删除修改之后的副作用
    useEffect(() => {
        getUserInfo()
    }, []);
    const getUserInfo = () => {
        setTimeout(() => {
          axios.post(`${api}/getAllBill`).then(function (response) {
            console.log(response);
            setDataSource(response.data.data);
            setLoading(false);
          }).catch(function (error) {
            console.log(error)
          });
        }, 1000)
      }
  return (
    <div className='table'>
      <Form>
        <Table
          bordered
          dataSource={dataSource}
          columns={columns}
          loading={loading}
          />
      </Form>
    </div>
  )
}
